package com.ss.android.newmedia.webview;

import android.annotation.TargetApi;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.webkit.DownloadListener;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.bytedance.article.common.c.TTUtils;
import com.bytedance.ttnet.a.AppConfig;

import java.util.Map;

public class SSWebView extends WebView {
    public SSWebView(Context arg1) {
        super(arg1);
    }

    public SSWebView(Context arg1, AttributeSet arg2) {
        super(arg1, arg2);
    }

    public SSWebView(Context arg1, AttributeSet arg2, int arg3) {
        super(arg1, arg2, arg3);
    }

    private String a(String rul) {
        Context context = this.getContext();
        if (context != null && (TTUtils.isValidUrl(rul))) {
            rul = AppConfig.getInstance(context).c(rul);
        }

        return rul;
    }

    public boolean canGoBack() {
        boolean v0_1;
        try {
            v0_1 = super.canGoBack();
        } catch (Exception v0) {
            v0_1 = false;
        }

        return v0_1;
    }

    public boolean canGoBackOrForward(int arg2) {
        boolean v0_1;
        try {
            v0_1 = super.canGoBackOrForward(arg2);
        } catch (Exception v0) {
            v0_1 = false;
        }

        return v0_1;
    }

    public boolean canGoForward() {
        boolean v0_1;
        try {
            v0_1 = super.canGoForward();
        } catch (Exception v0) {
            v0_1 = false;
        }

        return v0_1;
    }

    public void clearCache(boolean arg2) {
        try {
            super.clearCache(arg2);
        } catch (Exception v0) {
        }
    }

    public void clearFormData() {
        try {
            super.clearFormData();
        } catch (Exception v0) {
        }
    }

    public void clearHistory() {
        try {
            super.clearHistory();
        } catch (Exception v0) {
        }
    }

    public void computeScroll() {
        try {
            super.computeScroll();
        } catch (Exception v0) {
        }
    }

    public int getContentHeight() {
        int v0_1;
        try {
            v0_1 = super.getContentHeight();
        } catch (Exception v0) {
            v0_1 = 1;
        }

        return v0_1;
    }

    public String getOriginalUrl() {
        String v1;
        try {
            v1 = super.getOriginalUrl();
            if (v1 != null && (v1.startsWith("data:text/html"))) {
                String v0_1 = super.getUrl();
                if (v0_1 != null) {
                    if (!v0_1.startsWith("file://")) {
                        return v1;
                    }

                    return v0_1;
                }
            }
        } catch (Exception v0) {
            return null;
        }

        return v1;
    }

    public int getProgress() {
        int v0_1;
        try {
            v0_1 = super.getProgress();
        } catch (Exception v0) {
            v0_1 = 100;
        }

        return v0_1;
    }

    public String getUrl() {
        String v0_1;
        try {
            v0_1 = super.getUrl();
        } catch (Exception v0) {
            v0_1 = null;
        }

        return v0_1;
    }

    public void goBack() {
        try {
            super.goBack();
        } catch (Exception v0) {
        }
    }

    public void goBackOrForward(int arg2) {
        try {
            super.goBackOrForward(arg2);
        } catch (Exception v0) {
        }
    }

    public void goForward() {
        try {
            super.goForward();
        } catch (Exception v0) {
        }
    }

    public void loadData(String arg2, String arg3, String arg4) {
        try {
            super.loadData(arg2, arg3, arg4);
        } catch (Exception v0) {
        }
    }

    public void loadDataWithBaseURL(String baseURL, String data, String mimeType, String encoding, String historyUrl) {
        try {
            super.loadDataWithBaseURL(baseURL, data, mimeType, encoding, historyUrl);
        } catch (Exception exception) {
        }
    }

    public void loadUrl(String arg2) {
        try {
            super.loadUrl(this.a(arg2));
        } catch (Exception v0) {
        }
    }

    @TargetApi(value = 19)
    public void loadUrl(String url, Map<String, String> additionalHttpHeaders) {
        try {
            super.loadUrl(this.a(url), additionalHttpHeaders);
        } catch (Exception v0) {
        }
    }

    public boolean onTouchEvent(MotionEvent arg2) {
        boolean v0_1;
        try {
            v0_1 = super.onTouchEvent(arg2);
        } catch (Throwable v0) {
            v0_1 = false;
        }

        return v0_1;
    }

    public void postUrl(String arg2, byte[] arg3) {
        try {
            super.postUrl(this.a(arg2), arg3);
        } catch (Exception v0) {
        }
    }

    public void reload() {
        try {
            super.reload();
        } catch (Exception v0) {
        }
    }

    public void setBackgroundColor(int arg2) {
        try {
            super.setBackgroundColor(arg2);
        } catch (Exception v0) {
        }
    }

    public void setDownloadListener(DownloadListener arg2) {
        try {
            super.setDownloadListener(arg2);
        } catch (Exception v0) {
        }
    }

    public void setNetworkAvailable(boolean arg2) {
        try {
            super.setNetworkAvailable(arg2);
        } catch (Exception v0) {
        }
    }

    public void setWebChromeClient(WebChromeClient arg2) {
        try {
            super.setWebChromeClient(arg2);
        } catch (Exception v0) {
        }
    }

    public void setWebViewClient(WebViewClient arg2) {
        try {
            super.setWebViewClient(arg2);
        } catch (Exception v0) {
        }
    }

    public void stopLoading() {
        try {
            super.stopLoading();
        } catch (Exception v0) {
        }
    }
}

